class Solution {
public:
    int Recmul(int A, int* pi, int B, int* psum)
    {
        if (*pi >= B)
            return (*psum);
        (*psum) += A;
        (*pi)++;
        Recmul(A, pi, B, psum);
        return (*psum);
    }
    int multiply(int A, int B) {
        int i = 0;
        int sum = 0;
        int ret = Recmul(A, &i, B, &sum);
        return sum;
    }
};